<template>
  <div>
<h1>用户赎回页面</h1>
<table class="table table-bordered">
      <tr>
        <td>项目名称</td>
        <td>{{state.CName}}</td>
      </tr>
      <tr>
        <td>项目理财总金额</td>
        <td>{{state.CZongE}}</td>
      </tr>
      <tr>
        <td>用户理财金额</td>
        <td>{{state.CJinE}}</td>
      </tr>
      <tr>
        <td>用户赎回金额</td>
        <td><input type="text" v-model="Money"></td>
      </tr>
      <tr>
        <td></td>
        <td><input type="button" value="确认赎回" @click="ok"></td>
      </tr>
    </table>
  </div>
</template>

<script setup lang="ts">
import { reactive, toRefs, onMounted } from 'vue';
import axios from 'axios';
import { useRoute, useRouter } from 'vue-router';
const router = useRouter();
const route = useRoute();

let data:any=reactive({
  state:{
    
  },
  Money:''
})

let {state,Money}=toRefs(data)

onMounted(()=>{
  getDate()
})

const getDate=()=>{
axios({
  url:'/api/Users/FanTian',
  method:'get',
  params:{
    Cid:route.query.Cid
  }
})
.then(res=>{
  state.value=res.data.data
})
.catch(err=>{
  console.log(err);
  
})
}

const ok=()=>{  
  if(Number(Money.value)>=state.value.CJinE){
    alert('赎回金额不能大于理财金额');
    return;
  }
}
</script>

<style scoped>

</style>